package com.example.czy.base.qo;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 基础分页参数
 *
 * @author czy
 * @date 2023-07-09
 **/

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageQO {
    @ApiModelProperty("页码")
    private Long current;

    @ApiModelProperty("数量")
    private Long size;

    public Long getCurrent() {
        return this.current != null && this.current > 0L ? this.current : 1L;
    }

    public Long getSize() {
        if (this.size == null) {
            this.size = 10L;
        }

        if (this.size < 0L) {
            this.size = 0L;
        }

        return this.size;
    }

}
